package zheezes.swt.util;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Shell;

public class SWTUtil {
	public static void setCenter(Shell shell) {
		Rectangle rtg = shell.getMonitor().getClientArea();
		int width = rtg.width;
		int height = rtg.height;
		int x = shell.getSize().x;
		int y = shell.getSize().y;
		Point p = new Point((width - x) / 2, (height - y) / 2);
		shell.setLocation(p);
	}
}
